<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

<h:head>
	<title>Personalizzazione Pacchetto</title>
	<h:outputStylesheet library="TdTheme" name="css/style.css"/> 	
</h:head>

<h:body>
	<h:form>      
	    <p:menubar>
	    	<p:menuitem value="Homepage" icon="ui-icon-contact" url="home.xhtml?faces-redirect=true"/> 
	         
	        <f:facet name="options">
	        	<p:outputLabel value="Benvenuto, #{utenteManagedBean.nome}" style="margin-right:10px"/>  
	            <p:commandButton value="Modifica Profilo" icon="ui-icon-contact" action="modifica_utente.xhtml?faces-redirect=true"/>
	            <p:commandButton value="Logout" icon="ui-icon-extlink" action="#{loginManagedBean.logout()}"/>  
	        </f:facet>  
	    </p:menubar>  
  	</h:form>
	<p:panel id="attivita_panel">
		<h:form id="search_form">
			<h2 style="margin-left:auto; margin-right:auto;">Scegli le attività da inserire nel pacchetto</h2>
			<p:panelGrid columns="2" style="width:100%">
				<h:panelGrid>
					<p:outputLabel>Attività disponibili:</p:outputLabel>
					<p:selectManyMenu value="#{personalizzazioneManagedBean.attivitaScelte}" var="a" style="width:100%" converter="AttivitaConverter" showCheckbox="true">
						<f:selectItems value="#{personalizzazioneManagedBean.getAttivitaCompatibiliNonInPP()}" var="ac" itemLabel="ac.nome"/>
						<p:column headerText="Nome">
							#{a.nome}
						</p:column>
						<p:column headerText="Prezzo">
							#{a.prezzo}
						</p:column>
					</p:selectManyMenu>
				</h:panelGrid>
				<h:panelGrid>
					<p:outputLabel>Attività già comprese nel pacchetto:</p:outputLabel>
					<p:selectOneListbox var="a" style="width:100%">
						<f:selectItems value="#{personalizzazioneManagedBean.getAttivitaObbligatorie()}" var="ac" itemLabel="ac.nome"/>
						<p:column>
							#{a.nome}
						</p:column>
					</p:selectOneListbox>
				</h:panelGrid>
			</p:panelGrid>
			<p:messages autoUpdate="true"/>
			<p:commandButton id="indietro_btn" value="Indietro" styleClass="ui-priority-primary" action="personalizzazione2.xhtml"/>
			<p:commandButton value="Prosegui" styleClass="ui-priority-primary" action="#{personalizzazioneManagedBean.salvaAttivita()}"/>
		</h:form>
	</p:panel>
</h:body>
</html>